package com.gu.alipaytestboot.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author Mr.Gu
 * @date 2020/1/12 15:02
 * @function :
 **/
public class AlipayConfig {

    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102100729993";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDPuAAABHkwhvldn9EqGxppBmaYxJQVGroG/FPa5NW+kHCYWUE/Jo4GqJZ7bT2vQMZPxx0iC3G9Fu172I+MvyDffLWzQda15/n6G8cRr3r93dSs7syzX2UcQgtxEmotfEdQN6unauH3OLXlTkBXbX0nJATP9GJiQNVH/Xk0ZXnnyVXLWb/gV8fAFmU2M6eOOUPYmKrIH8UBhnp0Jf+oCuLbV+NHILYEcLs+1OaSulnsNisYdxAiIVmtJwYwCincz2dA94fhJiHpyfqlWpOLMVM69n6OzijgmtZiS6AwHc54JwtdHSPO95ruDfDsxAwBpFxYx68hi1/lNWuYGLv9U/sVAgMBAAECggEBAKoKNS3Oe6rHA0GqP56ZW1BYZgpu+c4g9+IaE0cghv0d3p5Iion4tNEslyto7NMXUoAiPm4NMkmZiEUWrcSI/Y8V1uRsZCi7Qr6EmLyYizVgr+X1AmtgDzRHuHgSnAqqLvKy7/j4HQy1Run02eT4AzjUWoAlzZgi/LWXAO5sl5OummBxaeMGlGeckfRt+nNCmfgxYzEImS5N2siKY47F9Fhg8iQhHq+xutRSNLj26okoASDys0xvxz50p0jxgeorXhNBSrfZLu5znbcUIU1kDuyHl+v1G+jA+XuIZgRGXyK5twNHAWTrHVLFREuyjW9/s5cyQhGrOCTBTzX45vuBmw0CgYEA8nk/9D7jYai/AtBLI6UUMSZfCykOCGAHfok6t42gJw4YiYrPR5A0NZUPmJCq8xANNdC7a/0xW7dRJnaGVlRyhTVPOwAJ+Tf1q9qFcARjZHCiVdttLTeuCSujBG8XnA/hBcK0KFCiwT7OWvFkRJF6hPK5tbGCzbGZgZ9nmBOZ1dcCgYEA205q/+c3LgvFG7RZ+8Q+nEHkNkX1LUX+HhiKgBqP+gJyRupa0YHPYUc9EOoX5d1fzG8nPQVspqQLEhoewtte95Keu6ogIU9JABQwhVhZgouFOY1KYAZe8hjGD9VUuUfTh5OJ5kiL6k4dz6Ez9ZmRPEO49tjPcwSucV5kUepiAPMCgYEAgyK4R+xLJWISC/+C48A/72UFOg/2Gul0pCarruHVn8mr05dTCy0eT2xShvyWt+YSfuxosLq6mxPFu7uWY9JALXLraslWm4Z8Q3lneXGmH4gbA7wsi6v1X9hNzfQXHLwpwufOb49Mtp61E9JBnCPh001CytU6HOzUTJpdeI4BQPkCgYB3cVhZlCa7j3GFS08PDq1DEagn3yZPyCVFYvxcFRuBgT+YXB+mp9q5EsGxqq3lZhK9F3T5iTDJ+eKFs3A5lJ0+nb6SW3AwdCxAPL7IgXwO28pttARkFFQ160REb147o2EUIEklATIjJPSblyLjiwZNGl1tJFyoOk6ANHbTHqLN/QKBgQDocqnSKM8RuxF3XLqyADoOV68lOpBP3tbutH0PQ/+gwLYM9s3/txHhuIlWNMSacnqKKyBzvmZqBVp6zjF6UQbdx6jb3Kx9U+KpENEWRms+sXljj0fEJ7CZXpaB+hAFYCntd7PlrIh2Z1qnEs5oawzK+m69Ms3b4Wy2RAlpn+Q6jQ==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnCKUKtADXztkHkjq/vM/2uwQCfRCSRXehnlCzu/pwQ5oRrzwebaiVqL8XDV5OlsbYSPxo8h4sG/FzXox+Nu7fRiOIVJMgrwD3AMFfoe5zLfR/J7R6x5QS2zrF4wn7WN3b6xzU7nlU+6ZjrxdA/xkvvfdX9NXhG0ApJ+tVLa2RD4Ns5EWTmcvfK4A6XzEblCXIaSrLRuwCJTsCr6k70u9i/qqsEaB6TMXdS6/21bU9rQ9VoEQYef6RMZvwYwufqO3wSLIDynBE0JpYYpt/QtxNZmPeqhMLy0SsiGNxrYRNXMU0S9Y0zMEVwxmTfzE7fTUekg5C+/XNCz8hwOF7v9y1wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:9999/pay/success";

    // 支付成功页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，
    //这里现在写的是支付页面的完整路径，从浏览器上复制下来
    public static String return_url = "http://127.0.0.1:8848/weixinpay_test/html/alipay.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
